package com.candy.db.generator.config;

import com.candy.db.generator.utils.PropertyUtil;

/**
 *  全局配置
 * Created by yantingjun on 2016/7/13.
 */
public class GlobalConfig {
    private static final String DEFAULT_CONFIG_FILE = "config.properties";
    public static final String DEFAULT_DAO_DIR = "dao";
    public static final String DEFAULT_MODEL_DIR = "model";
    public static final String DEFAULT_BASE_MODEL_DIR = "base";

    public static String dbConnectionUrl = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"db.url","");
    public static String dbDriverName = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"db.driver","");
    public static String dbUsername = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"db.username","");
    public static String dbPassword = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"db.password","");
    public static String classAuthor = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"class.author",System.getProperty("user.name"));
    public static String exportFileSuffix = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"export.file.suffix",".java");
    public static String outDir = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"out.dir","");
    public static String baseModelOutDir = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"out.basemodel.dir","");
    public static String modelOutDir = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"out.model.dir","");
    public static String daoOutDir = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"out.dao.dir","");

    public static String baseModelPackageName = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"basemodel.package.name","");
    public static String modelPackageName = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"model.package.name","");
    public static String daoPackageName = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"dao.package.name","");

    public static boolean generateBaseModel = PropertyUtil.getBooleanValue(DEFAULT_CONFIG_FILE, "genarate.basemodel", false);
    public static boolean overrideForce = PropertyUtil.getBooleanValue(DEFAULT_CONFIG_FILE, "config.force", false);
    public static String templateGroup = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"template.group","default");
    public static String excludeTables = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"tables.exclude","");
    public static String removedTableNamePrefixes = PropertyUtil.getValue(DEFAULT_CONFIG_FILE,"tables.remove.prefix","");
}
